import * as dd from 'dingtalk-jsapi'

export function GetCode(callback) {
    const corpId = 'dingbeeebed0cb750c8135c2f4657eb6378f' //钉钉企业id
    if (dd.env.platform !== 'notInDingTalk') {
        dd.ready(() => {
            dd.runtime.permission.requestAuthCode({
                corpId: corpId,
                onSuccess: (info) => {
                    callback(info.code)
                },
                onFail: (err) => {
                    alert('fail')
                    alert(JSON.stringify(err))
                }
            })
        })
    }
}
